﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace Address_Book
{
    public partial class frmExport : Form
    {
        public frmExport()
        {
            InitializeComponent();
        }

        private void button2_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            this.Hide();
            if (radioButton1.Checked == true)//保存为CSV格式文件
            {
                SaveFileDialog sf = new SaveFileDialog();
                sf.Filter = "CSV文件|*.CSV";
                sf.InitialDirectory = "C:\\";
                if (sf.ShowDialog() == DialogResult.Cancel)
                {
                    this.Show();
                    return;
                }
                else
                {
                    string filename = sf.FileName;
                    Address_Book.BLL.Export export = new Address_Book.BLL.Export();
                    export.SaveCSV(filename);
                    MessageBox.Show("CSV文件保存成功！");
                    this.Close();
                }
            }
            else
            {
 
            }
        }
    }
}